package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.JyjcExpensesLs;
import com.ruoyi.system.service.IJyjcExpensesLsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 财务收入支出统计Controller
 * 
 * @author ruoyi
 * @date 2025-07-13
 */
@RestController
@RequestMapping("/system/JyjcExpensesLs")
public class JyjcExpensesLsController extends BaseController
{
    @Autowired
    private IJyjcExpensesLsService jyjcExpensesLsService;

    /**
     * 查询财务收入支出统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:JyjcExpensesLs:list')")
    @GetMapping("/list")
    public TableDataInfo list(JyjcExpensesLs jyjcExpensesLs)
    {
        startPage();
        List<JyjcExpensesLs> list = jyjcExpensesLsService.selectJyjcExpensesLsList(jyjcExpensesLs);
        return getDataTable(list);
    }

    /**
     * 导出财务收入支出统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:JyjcExpensesLs:export')")
    @Log(title = "财务收入支出统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JyjcExpensesLs jyjcExpensesLs)
    {
        List<JyjcExpensesLs> list = jyjcExpensesLsService.selectJyjcExpensesLsList(jyjcExpensesLs);
        ExcelUtil<JyjcExpensesLs> util = new ExcelUtil<JyjcExpensesLs>(JyjcExpensesLs.class);
        util.exportExcel(response, list, "财务收入支出统计数据");
    }

    /**
     * 获取财务收入支出统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:JyjcExpensesLs:query')")
    @GetMapping(value = "/{year}")
    public AjaxResult getInfo(@PathVariable("year") String year)
    {
        return success(jyjcExpensesLsService.selectJyjcExpensesLsByYear(year));
    }

    /**
     * 新增财务收入支出统计
     */
    @PreAuthorize("@ss.hasPermi('system:JyjcExpensesLs:add')")
    @Log(title = "财务收入支出统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JyjcExpensesLs jyjcExpensesLs)
    {
        return toAjax(jyjcExpensesLsService.insertJyjcExpensesLs(jyjcExpensesLs));
    }

    /**
     * 修改财务收入支出统计
     */
    @PreAuthorize("@ss.hasPermi('system:JyjcExpensesLs:edit')")
    @Log(title = "财务收入支出统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JyjcExpensesLs jyjcExpensesLs)
    {
        return toAjax(jyjcExpensesLsService.updateJyjcExpensesLs(jyjcExpensesLs));
    }

    /**
     * 删除财务收入支出统计
     */
    @PreAuthorize("@ss.hasPermi('system:JyjcExpensesLs:remove')")
    @Log(title = "财务收入支出统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{years}")
    public AjaxResult remove(@PathVariable String[] years)
    {
        return toAjax(jyjcExpensesLsService.deleteJyjcExpensesLsByYears(years));
    }
}
